﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DatabaseCompare.Model
{

    /// <summary>
    /// 触发器 比较结果
    /// </summary>
    public class TriggerCompareResult : CompareAbleResult<TriggerInfo>
    {

        /// <summary>
        /// 是否被禁用不同.
        /// </summary>
        public bool IsDisableDifference { set; get; }

        /// <summary>
        /// 是否是 InsteadOf 触发器 不同.
        /// </summary>
        public bool IsInsteadOfTriggerDifference { set; get; }

        /// <summary>
        /// 创建触发器的语句 不同.
        /// </summary>
        public bool CreateTriggerSQLDifference { set; get; }



        public override string GetDifferenceString()
        {

            StringBuilder buff = new StringBuilder();
            buff.Append("不匹配[");

            if (IsDisableDifference)
            {
                buff.AppendFormat("是否被禁用({0},{1})", Left.IsDisable, Right.IsDisable);
            }

            if (IsInsteadOfTriggerDifference)
            {
                buff.AppendFormat("是否是InsteadOf 触发器({0},{1})", Left.IsInsteadOfTrigger, Right.IsInsteadOfTrigger);
            }

            if (CreateTriggerSQLDifference)
            {
                buff.AppendFormat("创建触发器的语句({0},{1})", Left.CreateSQL, Right.CreateSQL);
            }

            buff.Append("]");
            return buff.ToString();
        }

    }

}
